﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
    public class MovementTransport
    {
        public int clientBuild;
        public UInt64 TransportGUID;
        public Coord4 TransportOffset;
        public UInt32 TransportTime;
        public byte TransportSeat;
        public UInt32 TransportTime2;

        public MovementTransport()
        {
        }
        public MovementTransport(System.IO.BinaryReader reader, int clientbuild, uint opcode)
        {
            clientBuild = clientbuild;
            TransportGUID = reader.popGuid();
            TransportOffset = reader.ReadCoord4();
            TransportTime = reader.ReadUInt32();

            if (clientbuild >= 9183)
                TransportSeat = reader.ReadByte();
            else
                TransportSeat = 0;

             
        }

        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.AppendLine(string.Format("{0} {1} = {2} {3}", "UInt64", "TransportGUID", TransportGUID, "packedguid"));
            sb.AppendLine(TransportOffset.ToString());
            sb.AppendLine(string.Format("{0} {1} = {2}", "UInt32", "TransportTime", TransportTime));
            if (clientBuild >= 9183)
            {
                sb.AppendLine(string.Format("{0} {1} = {2}", "byte", "TransportSeat", TransportSeat));
            }
              
            return sb.ToString();
        }

    }
}
